<?php
require 'search.html';
require 'db.php';
$sqlstr  = "select * from student";

if(isset($_GET['sub'])){
    if($_GET['search'] != ""){
        $sqlstr  .= " where name = like '%".$_GET['search']."%' or Id like '%".$_GET['search']."%'"; //模糊匹配
    }
}
echo $sqlstr;
echo "<br>";

$result = mysqli_query($link, $sqlstr);
$data = mysqli_fetch_all($result); 

mysqli_free_result($result);
mysqli_close($link);

require 'showdata.html';
?>